<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script>
        // JSON语法，值由一对{}括起来
        // 内容是由一些列的键值对组成
        var user={
            "username":"alice",
            "age":20,
            "sex":"男"
        };
        console.log(user);

        //获取值，对象.属性名   对象[属性名]
        console.log(user.username);
        console.log(user["age"]);
        console.log(user["sex"]);

        //设置值
        // 对象.属性名=值
        // 对象["属性名"]=值
        user["height"]=190;//添加height属性
        user["username"]="coco";//重新赋值
        console.log(user);


        var arrs=[1,2,3];
        var users=[{
            "id":1,
            "username":"admin",
            "password":"123456"
        },{
            "id":2,
            "username":"lucy",
            "password":"111"
        },{
            "id":3,
            "username":"lili",
            "password":"222"
        }];
        console.log(users);
        for(var i=0;i<users.length;i++){
            // console.log(users[i]);
            console.log(users[i].id+"----"+users[i].username+users[i]["password"])
        }

    </script>
</head>
<body>

</body>
</html>